#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2023/10/1 18:54
# @Author  : 孙俊
# @FileName: curd.py
# @Software: PyCharm

from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker


# 建立连接工具
class connect:
    def __init__(self):
        self.url = 'mysql+pymysql://root:12345678@localhost:3306/test1?charset=utf8'
        self.engine = create_engine(self.url)

    def db(self):
        Sessionmaker = sessionmaker(autocommit=False, autoflush=False, bind=self.engine)
        db = Sessionmaker()
        return db


Connect = connect()
